<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户信息展示</title>
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/user_info.css">
    <link rel="stylesheet" href="css/game_hall.css">
    <script src="js/jquery.min.js"></script>
    <script src="js/common.js"></script>
</head>

<body>
  <div class="nav">
    五子棋对战
    <span class="spacer"></span>
    <div class="menu-container"> 
      <ul class="menu">
          <li><a href="">menu</a>
              <ul class="submenu">
                  <li><a href="game_hall.html">匹配房间</a></li>
                  <li><a href="login.html">退出</a></li>
              </ul>
          </li>
      </ul>
  </div>
</div>
  </div>
  <!-- 版心 -->
  <div class="container">
    <div class="card">
      <div class="login-dialog">
    </div>
      <div>
        <img src="" class="avtar" alt="" id="photo">
      </div>
      <div class="row">
          <span>用户名</span>
          <span id="username"></span>
      </div>
      <div class="row">
        <span>性别 </span>
        <span id="gender"></span>
      </div>
      <div class="row">
        <span>比赛场数 </span>
        <span id="totalCount"></span>
      </div>
      <div class="row">
        <span>胜场 </span>
        <span id="winCount"></span>
      </div>
      <div class="row">
        <span>胜率 </span>
        <span id="percentage"></span>
      </div>
      <div class="row">
        <span>个人简介 </span>
        <span id="showself"></span>
      </div>
      <div class="row">
        <span>所在地区 </span>
        <span id="place"></span>
      </div>
</div>
    <script>
       
      //获取个人信息
      function showInfo(){
            jQuery.ajax({
<!--                url:"http://"+ location.host + "/user/showuserinfo",-->
                url:"/user/showuserinfo",

                type:"POST",
                data:{},
                success:function(result){
                    if(result!=null && result.code==200){
                        jQuery("#gender").text(result.data.gender);
                        jQuery("#totalCount").text(result.data.totalCount);
                        jQuery("#username").text(result.data.username);
                        jQuery("#winCount").text(result.data.winCount);
                        jQuery("#percentage").text(result.data.percentage);
                        jQuery("#showself").text(result.data.showself);
                        jQuery("#place").text(result.data.place);
                        $("#photo").attr("src","http://"+ location.host + result.data.photo);
                      }else{
                        alert("个人信息加载失败，请重新刷新再试！");
                    }
                }
            });
        }
        showInfo();
    </script>
  </div>
</body>

</html>